package com.tianji.learning.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tianji.api.dto.leanring.LearningLessonDTO;
import com.tianji.api.dto.leanring.LearningRecordDTO;
import com.tianji.common.domain.query.PageQuery;
import com.tianji.learning.domain.dto.LearningRecordFormDTO;
import com.tianji.learning.domain.vo.LearningPlanVO;
import com.tianji.learning.service.ILearningRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 学习记录表 前端控制器
 * </p>
 *
 * @author zhongweiwei
 * @since 2023-05-26
 */
@Api(tags = "学习记录")
@RestController
@RequestMapping("/learning-records")
@RequiredArgsConstructor
public class LearningRecordController {
    private final ILearningRecordService learningRecordService;


@ApiOperation("根据课程id查询指定的课程的学习记录")
@GetMapping("/course/{courseId}")
@ApiParam(value = "课程id", example = "1")
public LearningLessonDTO queryLearningRecordByCourse(@PathVariable("courseId") Long courseId) {

    return learningRecordService.queryLearningRecordsByCourseId( courseId);
}
/**
 * 提交学习记录
 */
@ApiOperation("提交学习记录")
@PostMapping("/{id}/submit")

public void submit(@RequestBody LearningRecordFormDTO formDTO) {
    learningRecordService.submitLearningRecord(formDTO);
}


  
}
